using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Proxy.DynamicProxy;

namespace CustomORM.Examples.CustomORM.vs.NH
{
    public class NhBootstrap
    {
        public static ISessionFactory CreateSessionFactory(string connectionString, string providerName)
        {
            var sessionFactory = Fluently.Configure()
                .Database(MsSqlCeConfiguration.Standard.ConnectionString(connectionString))
                //.ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle")
                //.Database(MsSqlCeConfiguration.Standard.ConnectionString("").p)
                .Mappings(x=>x.FluentMappings.AddFromAssemblyOf<Program>())
                
                .BuildSessionFactory();

            return sessionFactory;
        }

        //public ISession GetSession()
        //{
        //    var sessionFactory = CreateSessionFactory();
        //    sessionFactory.OpenSession()
        //}
    }
}